// 接口类型定义(使用命名空间)

/**通用分页信息
 */
export interface IPageInfo {
    pageNum: number;
    pageSize: number;
    total: number;
}

/**通用分页参数
 */
export interface IPageParams {
    pageNum: number;
    pageSize?: number;
}

/**通用响应数据格式
 */
export interface IResponseData<T = unknown> {
    code: string;
    msg: string;
    data: T;
}

/**通用分页数据
 */
export interface IListData<T = unknown> {
    list: T[];
    page: IPageInfo;
}

/**登录接口参数类型
 */
export namespace ILogin {
    export interface Params {
        username: string;
        password: string;
    }
}

/**首页模块接口参数类型
 */
export namespace IDashboard {
    export interface ReportData {
        driverCount: number;
        totalMoney: number;
        orderCount: number;
        cityNum: number;
    }
    export interface LineData {
        label: string[];
        order: number[];
        money: number[];
    }
    export interface PieData {
        value: number;
        name: string;
    }
    export interface RadarData {
        indicator: Array<{ name: string; min: number; max: number }>;
        data: {
            name: string;
            value: number[];
        };
    }
}

/**用户模块接口参数类型
 */
export namespace IUser {
    export enum EUserState {
        // 所有
        ALL = '0',
        // 在职
        EMPLOYED = '1',
        // 离职
        UNEMPLOYED = '2',
        // 试用期
        PROBATION = '3'
    }
    export interface UserItem {
        createId: string;
        createTime: string;
        deptId: string;
        deptName: string;
        gender: string;
        job: string;
        lastLoginTime: string;
        mobile: string;
        roleList: string[];
        // 0 所有 1 在职 2 离职 3 试用期
        state: string;
        userEmail: string;
        userId: string;
        userImg: string;
        userName: string;
    }
    export interface Params extends IPageParams {
        userId?: string;
        userName?: string;
        state?: string;
    }
    export interface SearchParams {
        userId?: string;
        userName?: string;
        state?: string;
    }
    export interface CreateParams {
        deptId: string;
        gender: string;
        job?: string;
        mobile?: string;
        roleList?: string[];
        state?: string;
        userEmail: string;
        userImg: string;
        userName: string;
    }
    export interface EditParams extends CreateParams {
        userId: string;
    }
    export interface DeleteParams {
        userId: string;
    }
}

/**菜单模块接口参数类型
 */
export namespace IMenu {
    export enum EMenuState {
        // 启用
        ENABLE = '1',
        // 停用
        DISABLE = '2'
    }
    export enum EMenuType {
        // 菜单
        MENU = '1',
        // 按钮
        BUTTON = '2',
        // 页面
        PAGE = '3'
    }
    export interface MenuItem {
        // 按钮权限
        buttons?: MenuItem[];
        // 子菜单
        children?: MenuItem[];
        createId: string;
        createTime: string;
        icon: string;
        menuId: string;
        menuName: string;
        // 1：正常 2：停用
        menuState: string;
        // 1: 菜单(侧边栏) 2：按钮(权限) 3：页面(路由不在侧边栏展示)
        menuType: string;
        menuCode: string;
        orderBy: number;
        parentId: string;
        path: string;
        updateTime: string;
    }
    export interface Params {
        menuName?: string;
        menuState?: string;
    }
    export interface CreateParams {
        icon?: string;
        menuName: string;
        menuState: string;
        menuType: string;
        menuCode?: string;
        parentId?: string;
        path?: string;
        orderBy?: number;
    }
    export interface EditParams extends CreateParams {
        menuId: string;
    }
    export interface DeleteParams {
        menuId: string;
    }
}

/**角色模块接口参数类型
 */
export namespace IRole {
    export interface RoleItem {
        roleId: string;
        roleName: string;
        remark: string;
        permissionList: {
            checkedKeys: string[];
            halfCheckedKeys: string[];
        };
        updateTime: string;
        createTime: string;
    }
    export interface Params extends IPageParams {
        roleName?: string;
    }
    export interface SearchParams {
        roleName?: string;
    }
    export interface CreateParams {
        roleName: string;
        remark?: string;
    }
    export interface EditParams extends CreateParams {
        roleId: string;
    }
    export interface DeleteParams {
        roleId: string;
    }
    export interface Permission {
        roleId: string;
        permissionList: {
            checkedKeys: string[];
            halfCheckedKeys: string[];
        };
    }
}

/**部门模块接口参数类型
 */
export namespace IDept {
    export interface DeptItem {
        children: DeptItem[];
        createTime: string;
        createId: string;
        deptId: string;
        deptName: string;
        parentId: string;
        updateTime: string;
        userId: string;
        userName: string;
    }
    export interface Params {
        deptName?: string;
    }
    export interface CreateParams {
        deptName: string;
        parentId?: string;
        userId: string;
    }
    export interface EditParams extends CreateParams {
        deptId: string;
    }
    export interface DeleteParams {
        deptId: string;
    }
}
